import QtQuick 2.0
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2

Slider{
    id:controlsPositionSlider
    onValueChanged: {
        playerControlsModel.seek(value)
    }
    style: SliderStyle {
        groove: Rectangle {
            implicitHeight: 2
            implicitWidth: controlsPositionSlider.width
            color: "white"
            opacity: 0.5
            radius: 8
            Rectangle {
                implicitHeight: 2
                implicitWidth: controlsPositionSlider.width * (controlsPositionSlider.value / controlsPositionSlider.maximumValue)
                color: "red"
            }
        }

        handle: Rectangle {
            anchors.centerIn: parent
            color: "white"
            radius: 8
            width: 16
            height: 16
            Rectangle {
                anchors.centerIn: parent
                radius: 1
                width: 2
                height: 2
                color: "red"
            }
        }
    }

    Connections {
        target: playerControlsModel
        onChangePositionLabel: controlsPositionSlider.value = count
        onChangeDurationLabel: controlsPositionSlider.maximumValue = count
    }
}
